<template>
  <div>
    <!--<div class="app-container">-->
      <!--<el-table :data="list" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row>-->
        <!--<el-table-column align="center" label='ID' width="95">-->
          <!--<template slot-scope="scope">-->
            <!--{{scope.$index}}-->
          <!--</template>-->
        <!--</el-table-column>-->
        <!--<el-table-column label="Title">-->
          <!--<template slot-scope="scope">-->
            <!--{{scope.row.title}}-->
          <!--</template>-->
        <!--</el-table-column>-->
        <!--<el-table-column label="Author" width="110" align="center">-->
          <!--<template slot-scope="scope">-->
            <!--<span>{{scope.row.author}}</span>-->
          <!--</template>-->
        <!--</el-table-column>-->
        <!--<el-table-column label="Pageviews" width="110" align="center">-->
          <!--<template slot-scope="scope">-->
            <!--{{scope.row.pageviews}}-->
          <!--</template>-->
        <!--</el-table-column>-->
        <!--<el-table-column class-name="status-col" label="Status" width="110" align="center">-->
          <!--<template slot-scope="scope">-->
            <!--<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>-->
          <!--</template>-->
        <!--</el-table-column>-->
        <!--<el-table-column align="center" prop="created_at" label="Display_time" width="200">-->
          <!--<template slot-scope="scope">-->
            <!--<i class="el-icon-time"></i>-->
            <!--<span>{{scope.row.display_time}}</span>-->
          <!--</template>-->
        <!--</el-table-column>-->
      <!--</el-table>-->
    <!--</div>-->
    <div class="test">
      <img-inputer v-model="file" theme="light" size="small"/>
      <!--<vue-initials-img :name="'Frank Underwood'"/>-->
      <uploader :after-read="onRead">
        <!--<van-icon name="photograph" />-->
        <svg-icon :icon-class="'凯旋门'"></svg-icon>
      </uploader>
    </div>
  </div>
</template>

<script>
  import { getList } from '@/api/table'
  import ImgInputer from 'vue-img-inputer'
  import 'vue-img-inputer/dist/index.css'
  import VueInitialsImg from 'vue-initials-img'
  import { Uploader } from 'vant'

  export default {
    components: {
      ImgInputer,
      VueInitialsImg,
      Uploader
    },
    data() {
      return {
        list: null,
        listLoading: true
      }
    },
    filters: {
      statusFilter(status) {
        const statusMap = {
          published: 'success',
          draft: 'gray',
          deleted: 'danger'
        }
        return statusMap[status]
      }
    },
    created() {
      this.fetchData()
    },
    methods: {
      fetchData() {
        this.listLoading = true
        getList(this.listQuery).then(response => {
          this.list = response.data.items
          this.listLoading = false
        })
      },
      onRead(file) {
        console.log(file)
      }
    }
  }
</script>

<style scoped>
  .test >>> .img-inputer--small {
    max-width: 500px;
    max-height: 500px;
  }
</style>
